package com.iss.wyy.common;

public enum  RequestMethod {
     POST,GET,OPTIONS,PUT,DELETE,TRACE,CONNECT,HEAD;

     /**
      *
      * @param method 请求的方法字符串
      * @return 对应请求方法的枚举
      */
     public static RequestMethod getMethod(String method){
          method = method.toUpperCase();
          if(method.equals("POST")){
               return POST;
          }else if(method.equals("GET")){
               return GET;
          }else if(method.equals("OPTIONS")){
               return OPTIONS;
          }else if(method.equals("PUT")){
               return PUT;
          }else if(method.equals("DELETE")){
               return DELETE;
          }else if(method.equals("TRACE")){
               return TRACE;
          }else if(method.equals("CONNECT")){
               return CONNECT;
          }else if(method.equals("HEAD")){
               return HEAD;
          } else{
              throw new RuntimeException("未知的请求方法");
          }
     }
}
